package com.hippomeetsskunk.savanna.types.goal;

import java.util.Set;

import com.hippomeetsskunk.savanna.types.meta.ResourceType;
import com.hippomeetsskunk.savanna.types.person.Person;
import com.hippomeetsskunk.savanna.types.person.Skills;

public abstract class AbstractGoal {

	private final Skills requiredSkills;
	private final Set<ResourceType> requiredResources;
	
	/**
	 * main worker of goal.
	 * needs resources (and for most goals the skills).
	 */
	private final Person worker;
	
	private double value;
	private double urgency;
	private boolean active;
	
	public AbstractGoal(Person worker,
			Skills requiredSkills, Set<ResourceType> requiredResources,
			double value, double urgency){
		this.worker  = worker;
		this.requiredSkills = requiredSkills;
		this.requiredResources = requiredResources;
		this.value = value;
		this.urgency = urgency;
		this.active = false;
	}

	public Skills getRequiredSkills() {
		return requiredSkills;
	}

	public Set<ResourceType> getRequiredResources() {
		return requiredResources;
	}
	
	public double getValue() {
		return value;
	}
	
	public void setValue(double value) {
		this.value = value;
	}
	
	public double getUrgency() {
		return urgency;
	}
	
	public void setUrgency(double urgency) {
		this.urgency = urgency;
	}
	
	public boolean isActive() {
		return active;
	}
	
	public void setActive(boolean active) {
		this.active = active;
	}

	public Person getWorker() {
		return worker;
	}

	public boolean isMissingResources() {
		return getWorker().getMissingResources(requiredResources).size() > 0;
	}
}
